import request from "@/utils/request.ts";
import type { IUserLoginParams } from "@/types/login.ts";
import { IUpdateUserInfo } from "@/types/user";
import { IUpdateFriendGroupParams } from "@/types/friend.ts";

export function Login(params: IUserLoginParams) {
  return request.post("/public/login", params);
}

export function Register(params: any) {
  return request.post("/public/register", params);
}

export function UpdateInfo(params: IUpdateUserInfo) {
  return request.post("/updateUserInfo", params);
}

export const GetCaptcha = () => {
  return request.get("/public/generat");
};
// 获取好友分组
export const GetUserFriendGroup = () => {
  return request.get("getUserFriendGroup");
};

// 新增好友分组
export const CreateFriendGroup = (name: string) => {
  return request.get(`/createFriendGroup/${name}`);
};

// 更新好友分组
export const UpdateFriendGroup = (params: IUpdateFriendGroupParams) => {
  return request.post("/updateFriendGroup", params);
};

// 删除好友分组
export const DeleteFriendGroup = (groupId: number) => {
  return request.delete(`/deleteFriendGroup/${groupId}`);
};
